﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Org.Mentalis.Files;

namespace Portalz.Engine
{
    public class Data
    {
        public static IniReader ini = new IniReader(System.IO.Directory.GetCurrentDirectory() + @"\portalz.ini");
        public const int MIN_LEVEL = 1;
        public const int MAX_LEVEL = 20;
        public static Class[] classes = new Class[3];
        public static string[] characterList = new string[1];
        private static string log;

        public string Log
        {
            get { return log; }
        }

        public static void Initialize()
        {
            //Create classes
            classes[0] = new Class("Test 1", 100, 100, 100, 100, 100, 100);
            classes[1] = new Class("Test 2", 200, 200, 200, 200, 200, 200);
            classes[2] = new Class("Test 3", 300, 300, 300, 300, 300, 300);

            loadCharacterList();
        }

        public static void loadCharacterList()
        {
            characterList = new string[1];
            foreach (string section in ini.GetSectionNames())
            {
                Array.Resize<string>(ref characterList, characterList.Length + 1);
                characterList[characterList.Length - 1] = section;
            }
        }

        public static void Write(string value)
        {
            Console.Write(value);
            log += value;       
        }

        public static void WriteLine(string value)
        {
            Write("\n" + value);
        }

        public static int RandNum(int low, int high)
        {
            return (new Random()).Next(low, high);
        }
    }
}
